package org.om.action;

import org.om.dto.ModulesVo;
import org.om.excepion.BusinessException;
import org.om.model.Menus;
import org.om.model.Users;
import org.om.service.MenusService;
import org.om.service.UserService;
import org.redkale.convert.ArrayDecoder;
import org.redkale.convert.Convert;
import org.redkale.convert.json.JsonConvert;
import org.redkale.net.http.HttpRequest;
import org.redkale.net.http.HttpResponse;
import org.redkale.net.http.WebServlet;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

/**
 * Created by SPG on 2016/7/5.
 */
@WebServlet(value = {"/menus/*"}, moduleid = ModulesVo.MODULE_MENUS)
public class MenusServlet  extends  BaseServlet{
    @Resource
    private MenusService menusService;
    @Resource
    private JsonConvert jsonConvert;

    @AuthIgnore
    @WebAction(url = "/menus/urls")
    public void login(HttpRequest req, HttpResponse resp) throws IOException {
         List<Menus> list = menusService.getUrl();
        String json =jsonConvert.convertTo(list);
        System.out.printf(json);
        resp.finish(json);
    }
}
